﻿Imports WebSitePanel.SkinDesigner.Business.Css
Imports System.Drawing
Imports BoneSoft.CSS

Public Class Designer
    Protected _cssmanager As CssManager
    Private WithEvents _commgr As CommandManager = CommandManager.Instance
    Private _comfactory As CommandFactory
    Private _path As String
    Private _themename As String
    Public Sub New(ByVal Path As String, ByVal ThemeName As String)
        _path = Path
        _cssmanager = New CssManager()
        _comfactory = New CommandFactory(_cssmanager.Files)
        _themename = ThemeName
    End Sub
#Region "Commands"
#Region "DoUndo"
    Public Function CanUndo() As Boolean
        Return _commgr.CanUndo()
    End Function
    Public Function CanRedo() As Boolean
        Return _commgr.CanRedo()
    End Function
    Public Sub Undo()
        _commgr.Undo()
    End Sub
    Public Sub Redo()
        _commgr.Redo()
    End Sub
#End Region
#Region "Document"
    Public Property DocumentBackgroundColor As Color
        Get
            Return ThemeManager.GetSettingsColor("documentbackgroundcolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("documentbackgroundcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetDocumentBackGroundCommand(value))
        End Set
    End Property
    Public Property FooterFont As CssFont
        Get
            Return ThemeManager.GetSettingsFont("footerfont")
        End Get
        Set(ByVal value As CssFont)
            ThemeManager.SaveSettingsFont("footerfont", value)
            _commgr.ExecuteCommand(_comfactory.GetFooterFontCommand(value.FontSize, value.FontFamily, value.Bold, value.Italic, value.Underline, value.Color))
        End Set
    End Property
    Public Property DocumentBackgroundRepeat As BackgroundRepeat
        Get
            Return ThemeManager.GetSettingsBackgroundRepeat("documentbackgroundrepeat")
        End Get
        Set(ByVal value As BackgroundRepeat)
            ThemeManager.SaveSetting("documentbackgroundrepeat", value.ToString)
            _commgr.ExecuteCommand(_comfactory.GetDocumentBackgroundRepeatCommand(value))
        End Set
    End Property
    Public Property DocumentBackgroundImage As String
        Get
            Return ThemeManager.GetSetting("documentbackgroundimage")
        End Get
        Set(ByVal value As String)
            ThemeManager.SaveSetting("documentbackgroundimage", value)
            _commgr.ExecuteCommand(_comfactory.GetDocumentBackgroundImageCommand(value))
        End Set
    End Property
    Public Sub RemoveDocumentBackgroundImage()
        ThemeManager.SaveSetting("documentbackgroundimage", "")
        _commgr.ExecuteCommand(_comfactory.GetRemoveDocumentBackgroundImageCommand)
    End Sub
    Public Property DocumentBackgroundGradient As GradientDefinition
        Get
            Return ThemeManager.GetSettingsGradientDefinition("documentbackgroundgradient")
        End Get
        Set(ByVal value As GradientDefinition)
            ThemeManager.SaveSettingGradientDefinition("documentbackgroundgradient", value)
            _commgr.ExecuteCommand(_comfactory.GetDocumentBackgroundGradientCommand(value))
        End Set
    End Property
    Public Property FooterLinkColor As Color
        Get
            Return ThemeManager.GetSettingsColor("footerlinkcolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("footerlinkcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetFooterLinkColorCommand(value))
        End Set
    End Property
#End Region
#Region "Page"
    Public Property PageBackgroundColor As Color
        Get
            Return ThemeManager.GetSettingsColor("pagebackgroundcolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("pagebackgroundcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetPageColorCommand(value))
            ContainerColor = ContainerColor
            HeaderColor = HeaderColor
        End Set
    End Property
    Public Property Padding As Integer
        Get
            Return ThemeManager.GetSetting("pagepadding")
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("pagepadding", value)
            _commgr.ExecuteCommand(_comfactory.GetPagePaddingCommand(value))
        End Set
    End Property
    Public Property Offset As Integer
        Get
            Return ThemeManager.GetSetting("pageoffset")
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("pageoffset", value)
            _commgr.ExecuteCommand(_comfactory.GetPageOffsetCommand(value))
        End Set
    End Property
    Public Property PageBorderColor As Color
        Get
            Return ThemeManager.GetSettingsColor("pagebordercolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("pagebordercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetPageBorderColorCommand(value))
        End Set
    End Property
    Public Property PageBorderWidth As Integer
        Get
            Return ThemeManager.GetSetting("pageborderwidth")
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("pageborderwidth", value)
            _commgr.ExecuteCommand(_comfactory.GetPageBorderWidthCommand(value))
        End Set
    End Property
    Public Property PageBorderStyle As String
        Get
            Return ThemeManager.GetSetting("pageborderstyle")
        End Get
        Set(ByVal value As String)
            ThemeManager.SaveSetting("pageborderstyle", value)
            _commgr.ExecuteCommand(_comfactory.GetPageBorderStyleCommand(value))
        End Set
    End Property
    Public Property HeaderColor As Color
        Get
            Return ThemeManager.GetSettingsColor("headercolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("headercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetHeaderColorCommand(value))
        End Set
    End Property
    Public Property HeaderFont As CssFont
        Get
            Return ThemeManager.GetSettingsFont("headerfont")
        End Get
        Set(ByVal value As CssFont)
            ThemeManager.SaveSettingsFont("headerfont", value)
            _commgr.ExecuteCommand(_comfactory.GetAccountFontCommand(value.FontSize, value.FontFamily, value.Bold, value.Italic, value.Underline, value.Color))
        End Set
    End Property
    Public Property PageLinkColor As Color
        Get
            Return ThemeManager.GetSettingsColor("pagelinkcolor", "#0153a4")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("pagelinkcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetPageLinkColorCommand(value))
        End Set
    End Property
#End Region
#Region "TopMenu"
    Public Property TopMenuBackgroundColor As Color
        Get
            Return ThemeManager.GetSettingsColor("topmenubackgroundcolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("topmenubackgroundcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuImageCommand(value, TopMenuHeight, TopMenuGlowMode))
        End Set
    End Property
    Public Property TopMenuHoverColor As Color
        Get
            Return ThemeManager.GetSettingsColor("topmenuhovercolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("topmenuhovercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuHoverColorCommand(value, TopMenuHeight, TopMenuGlowMode))
        End Set
    End Property
    Public Property TopMenuHeight As Integer
        Get
            Return ThemeManager.GetSetting("topmenuheight")
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("topmenuheight", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuHeightCommand(value, TopMenuBackgroundColor, TopMenuHoverColor, TopMenuGlowMode))
        End Set
    End Property
    Public Property TopMenuSplitterWidth As Integer
        Get
            Return ThemeManager.GetSetting("topmenusplitterwidth")
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("topmenusplitterwidth", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuSplitterWidthCommand(value))
        End Set
    End Property
    Public Property TopMenuSplitterColor As Color
        Get
            Return ThemeManager.GetSettingsColor("topmenusplittercolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("topmenusplittercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuSplitterColorCommand(value))
        End Set
    End Property
    Public Property TopMenuTopBorderWidth As Integer
        Get
            Return ThemeManager.GetSetting("topmenutopborderwidth")
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("topmenutopborderwidth", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuTopBorderWidthCommand(value))
        End Set
    End Property
    Public Property TopMenuTopBorderColor As Color
        Get
            Return ThemeManager.GetSettingsColor("topmenutopbordercolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("topmenutopbordercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuTopBorderColorCommand(value))
        End Set
    End Property
    Public Property TopMenuBottomBorderWidth As Integer
        Get
            Return ThemeManager.GetSetting("topmenubottomborderwidth")
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("topmenubottomborderwidth", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuBottomBorderWidthCommand(value))
        End Set
    End Property
    Public Property TopMenuBottomBorderColor As Color
        Get
            Return ThemeManager.GetSettingsColor("topmenubottombordercolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("topmenubottombordercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuBottomBorderColorCommand(value))
        End Set
    End Property
    Public Property TopMenuGlowMode As GlowMode
        Get
            Return ThemeManager.GetSettingsGlowMode("topmenuglowmode", GlowMode.Contrast)
        End Get
        Set(ByVal value As GlowMode)
            ThemeManager.SaveSetting("topmenuglowmode", value.ToString)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuHeightCommand(TopMenuHeight, TopMenuBackgroundColor, TopMenuHoverColor, value))
        End Set
    End Property
    Public Property TopMenuFontColor As Color
        Get
            Return ThemeManager.GetSettingsColor("topmenufontcolor", "#ffffff")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("topmenufontcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuFontColorCommand(value))
        End Set
    End Property
    Public Property TopMenuFontHoverColor As Color
        Get
            Return ThemeManager.GetSettingsColor("topmenuhoverfontcolor", "#ffffff")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("topmenuhoverfontcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetTopMenuHoverFontColorCommand(value))
        End Set
    End Property
#End Region
#Region "SecondaryMenu"
    Public Property SecondaryMenuBackgroundColor As Color
        Get
            Return ThemeManager.GetSettingsColor("secondarymenubackgroundcolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("secondarymenubackgroundcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuColorCommand(value, SecondaryMenuTitleBackGroundColor, SecondaryMenuGradientColor, SecondaryMenuBorderColor))
        End Set
    End Property
    Public Property SecondaryMenuTitleBackGroundColor As Color
        Get
            Return ThemeManager.GetSettingsColor("secondarymenutitlebackgroundcolor", "#f9fdff")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("secondarymenutitlebackgroundcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuColorCommand(SecondaryMenuBackgroundColor, value, SecondaryMenuGradientColor, SecondaryMenuBorderColor))
        End Set
    End Property
    Public Property SecondaryMenuBorderColor As Color
        Get
            Return ThemeManager.GetSettingsColor("secondarymenubordercolor", "#86b9f7")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("secondarymenubordercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuColorCommand(SecondaryMenuBackgroundColor, SecondaryMenuTitleBackGroundColor, SecondaryMenuGradientColor, value))
        End Set
    End Property
    Public Property SecondaryMenuGradientColor As Color
        Get
            Return ThemeManager.GetSettingsColor("secondarymenugradientcolor", "#96cbfc")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("secondarymenugradientcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuColorCommand(SecondaryMenuBackgroundColor, SecondaryMenuTitleBackGroundColor, value, SecondaryMenuBorderColor))
        End Set
    End Property

    Public Property SecondaryMenuPosition As Position
        Get
            Return [Enum].Parse(GetType(Position), ThemeManager.GetSetting("secondarymenuposition"), True)
        End Get
        Set(ByVal value As Position)
            ThemeManager.SaveSetting("secondarymenuposition", value.ToString)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuPositionCommand(value))
        End Set
    End Property
    Public Property SecondaryMenuLeftPadding As Integer
        Get
            Return ThemeManager.GetSetting("secondarymenuleftpadding", 1)
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("secondarymenuleftpadding", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuPaddingCommand(value, SecondaryMenuTopPadding, SecondaryMenuRightPadding))
        End Set
    End Property
    Public Property SecondaryMenuRightPadding As Integer
        Get
            Return ThemeManager.GetSetting("secondarymenurightpadding", 10)
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("secondarymenurightpadding", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuPaddingCommand(SecondaryMenuLeftPadding, SecondaryMenuTopPadding, value))
        End Set
    End Property
    Public Property SecondaryMenuTopPadding As Integer
        Get
            Return ThemeManager.GetSetting("secondarymenutoppadding", 0)
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("secondarymenutoppadding", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuPaddingCommand(SecondaryMenuLeftPadding, value, SecondaryMenuRightPadding))
        End Set
    End Property
    Public Property SecondaryMenuHoverColor As Color
        Get
            Return ThemeManager.GetSettingsColor("secondarymenuhovercolor", "#f9fdff")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("secondarymenuhovercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuHoverCommand(value, SecondaryMenuBackgroundColor, SecondaryMenuBorderHoverColor, SecondaryMenuRoundedCorners, SecondaryMenuGlowMode))
        End Set
    End Property
    Public Property SecondaryMenuRoundedCorners As Boolean
        Get
            Return ThemeManager.GetSetting("secondarymenuroundedcorners", True)
        End Get
        Set(ByVal value As Boolean)
            ThemeManager.SaveSetting("secondarymenuroundedcorners", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuHoverCommand(SecondaryMenuHoverColor, SecondaryMenuBackgroundColor, SecondaryMenuBorderHoverColor, value, SecondaryMenuGlowMode))
        End Set
    End Property
    Public Property SecondaryMenuGlowMode As GlowMode
        Get
            Return ThemeManager.GetSettingsGlowMode("secondarymenuglowmode", GlowMode.Gradient)
        End Get
        Set(ByVal value As GlowMode)
            ThemeManager.SaveSetting("secondarymenuglowmode", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuHoverCommand(SecondaryMenuHoverColor, SecondaryMenuBackgroundColor, SecondaryMenuBorderHoverColor, SecondaryMenuRoundedCorners, value))
        End Set
    End Property
    Public Property SecondaryMenuBorderHoverColor As Color
        Get
            Return ThemeManager.GetSettingsColor("secondarymenubordercolor", "#a3d3ff")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("secondarymenubordercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuHoverCommand(SecondaryMenuHoverColor, SecondaryMenuBackgroundColor, value, SecondaryMenuRoundedCorners, SecondaryMenuGlowMode))
        End Set
    End Property
    Public Property SecondaryMenuTitleFont As CssFont
        Get
            Return ThemeManager.GetSettingsFont("secondarymenutitlefont")
        End Get
        Set(ByVal value As CssFont)
            ThemeManager.SaveSettingsFont("secondarymenutitlefont", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuTitleFontCommand(value.FontSize, value.FontFamily, value.Bold, value.Italic, value.Underline, value.Color))
        End Set
    End Property
    Public Property SecondaryMenuLinksFont As CssFont
        Get
            Return ThemeManager.GetSettingsFont("secondarymenulinksfont")
        End Get
        Set(ByVal value As CssFont)
            ThemeManager.SaveSettingsFont("secondarymenulinksfont", value)
            _commgr.ExecuteCommand(_comfactory.GetSecondaryMenuLinksFontCommand(value.FontSize, value.FontFamily, value.Bold, value.Italic, value.Underline, value.Color))
        End Set
    End Property
#End Region
#Region "Containers"
    Public Property ContainerColor As Color
        Get
            Return ThemeManager.GetSettingsColor("containercolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("containercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetContainerColorCommand(value, PageBackgroundColor, ContainerBorderColor, ContainerRoundedCorners, ContainerGlowMode))
        End Set
    End Property
    Public Property ContainerBorderColor As Color
        Get
            Return ThemeManager.GetSettingsColor("containerbordercolor", "#7f7f7f")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("containerbordercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetContainerColorCommand(ContainerColor, PageBackgroundColor, value, ContainerRoundedCorners, ContainerGlowMode))
        End Set
    End Property
    Public Property ContainerRoundedCorners As Boolean
        Get
            Return ThemeManager.GetSetting("containerroundedcorners", "true")
        End Get
        Set(ByVal value As Boolean)
            ThemeManager.SaveSetting("containerroundedcorners", value)
            _commgr.ExecuteCommand(_comfactory.GetContainerColorCommand(ContainerColor, PageBackgroundColor, ContainerBorderColor, value, ContainerGlowMode))
        End Set
    End Property
    Public Property ContainerGlowMode As GlowMode
        Get
            Return ThemeManager.GetSettingsGlowMode("containerglowmode", GlowMode.TopGlow)
        End Get
        Set(ByVal value As GlowMode)
            ThemeManager.SaveSetting("containerglowmode", value.ToString)
            _commgr.ExecuteCommand(_comfactory.GetContainerColorCommand(ContainerColor, PageBackgroundColor, ContainerBorderColor, ContainerRoundedCorners, value))
        End Set
    End Property
#End Region
#Region "BreadCrumb"
    Public Property BreadCrumbBackgroundColor As Color
        Get
            Return ThemeManager.GetSettingsColor("breadcrumbbackgroundcolor")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("breadcrumbbackgroundcolor", value)
            _commgr.ExecuteCommand(_comfactory.GetBreadCrumbBackGroundColorCommand(value))
        End Set
    End Property
    Public Property BreadCrumbFont As CssFont
        Get
            Return ThemeManager.GetSettingsFont("breadcrumbfont")
        End Get
        Set(ByVal value As CssFont)
            ThemeManager.SaveSettingsFont("breadcrumbfont", value)
            _commgr.ExecuteCommand(_comfactory.GetBreadCrumbFontCommand(value.FontSize, value.FontFamily, value.Bold, value.Italic, value.Underline, value.Color))
        End Set
    End Property
    Public Property BreadCrumbLinkFont As CssFont
        Get
            Return ThemeManager.GetSettingsFont("breadcrumblinkfont")
        End Get
        Set(ByVal value As CssFont)
            ThemeManager.SaveSettingsFont("breadcrumbfont", value)
            _commgr.ExecuteCommand(_comfactory.GetBreadCrumbLinkFontCommand(value.FontSize, value.FontFamily, value.Bold, value.Italic, value.Underline, value.Color))
        End Set
    End Property
    Public Property BreadCrumbBorderStyle As String
        Get
            Return ThemeManager.GetSetting("breadcrumbborderstyle", "solid")
        End Get
        Set(ByVal value As String)
            ThemeManager.SaveSetting("breadcrumbborderstyle", value)
            _commgr.ExecuteCommand(_comfactory.GetBreadCrumbBorderStyleCommand(value))
        End Set
    End Property
    Public Property BreadCrumbBorderWidth As Integer
        Get
            Return ThemeManager.GetSetting("breadcrumbborderwidth", "1")
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("breadcrumbborderwidth", value)
            _commgr.ExecuteCommand(_comfactory.GetBreadCrumbBorderWidthCommand(value))
        End Set
    End Property
    Public Property BreadCrumbBorderColor As Color
        Get
            Return ThemeManager.GetSettingsColor("breadcrumbbordercolor", "#86b9f7")
        End Get
        Set(ByVal value As Color)
            ThemeManager.SaveSettingsColor("breadcrumbbordercolor", value)
            _commgr.ExecuteCommand(_comfactory.GetBreadCrumbBorderColorCommand(value))
        End Set
    End Property
#End Region
#Region "RightPanel"
    Public Property RightPanelTitleFont As CssFont
        Get
            Return ThemeManager.GetSettingsFont("rightpaneltitlefont")
        End Get
        Set(ByVal value As CssFont)
            ThemeManager.SaveSettingsFont("rightpaneltitlefont", value)
            _commgr.ExecuteCommand(_comfactory.GetRightPanelTitleFontCommand(value.FontSize, value.FontFamily, value.Bold, value.Italic, value.Underline, value.Color))
        End Set
    End Property
    Public Property RightPanelPosition As Integer
        Get
            Return ThemeManager.GetSetting("rightpanelposition", 0)
        End Get
        Set(ByVal value As Integer)
            ThemeManager.SaveSetting("rightpanelposition", value)
            _commgr.ExecuteCommand(_comfactory.GetRightPanelPositionCommand(value))
        End Set
    End Property
#End Region
#End Region
#Region "Properties"
    Public ReadOnly Property AllCss() As List(Of KeyValuePair(Of String, String))
        Get
            Return (From f As KeyValuePair(Of CssFileType, CssFile) In _cssmanager.Files() Select New KeyValuePair(Of String, String)(f.Value.Name, f.Value.Text)).ToList
        End Get
    End Property
#End Region
#Region "ThemeManager"
    Public Sub Save()
        _cssmanager.SaveCss()
        ThemeManager.SaveTheme(_path, _themename)
    End Sub
    Public Sub SaveAs(ByVal Path As String)
        _cssmanager.SaveCss()
        ThemeManager.SaveTheme(Path, _themename)
    End Sub
    Public Sub CloseTheme()
        ThemeManager.Cleanup()
    End Sub
    Public Sub ExportTheme(ByVal Destination As String)
        ThemeManager.ExportTheme(Destination)
    End Sub
#End Region
#Region "Events"
    Public Event CssChanged(ByVal Sender As Object, ByVal e As CssChangedEventArgs)
    Public Event ImagingChanged(ByVal Sender As Object, ByVal e As EventArgs)
    Private Sub _commgr_CssChanged(ByVal Sender As Object, ByVal E As CssChangedEventArgs) Handles _commgr.CssChanged
        RaiseEvent CssChanged(Sender, E)
    End Sub
    Private Sub _commgr_ImagingChanged(ByVal Sender As Object, ByVal e As ImagingChangedEventArgs) Handles _commgr.ImagingChanged
        _cssmanager.ResetImages(e.ImagePath)
        RaiseEvent ImagingChanged(Sender, e)
    End Sub
#End Region
End Class
